<template>
	<div class="uiwu">
		<div class="uw-bg-white uw-pt-10 uw-mb-10 uw-pl-12">
			<uw-form :data="formData" @submit="serachSubmit">
				<uw-form-item :data="formData"></uw-form-item>
			</uw-form>
		</div>
		<uw-table :tableConfig="tableConfig">
			<template #button="{data,row}">
				<el-button v-for="item in data" :type="item.type" @click="handleButton(item,row)">{{item.label}}</el-button>
			</template>
		</uw-table>
	</div>
</template>

<script setup lang="ts">
	import { getUsersListApi , getUserConfigApi } from '@/api/api';
	import { onMounted, ref } from 'vue';
	const formData = ref()
	const tableConfig = ref()
	const formInline:any = ref({})
	const getUsersList = async () => {
		const {data:{list}} = await getUsersListApi({
			page: 1,
			limit: 10,
			...formInline.value
		});
		tableConfig.value.data = list
	}
	const serachSubmit = (data:any) => {
		formInline.value = data
		getUsersList()
	}
	const handleButton = (row:any) => {
		console.log(row);
	}
	
	onMounted(()=>{
		getUserConfigApi().then((res)=>{
			formData.value = res.data.formData
			tableConfig.value = res.data.tableConfig
			getUsersList();
		})
	})
</script>

<style scoped>
	
</style>